package com.linkage.jz.bankruptcy.fragment.Project;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.linkage.jz.bankruptcy.BankruptcyApp;
import com.linkage.jz.bankruptcy.Consts;
import com.linkage.jz.bankruptcy.R;
import com.linkage.jz.bankruptcy.activity.Project.ZQUser.CreateZQBCApplyActivity;
import com.linkage.jz.bankruptcy.activity.Project.ZQUser.CreateZQFristApplyActivity;
import com.linkage.jz.bankruptcy.adapter.FileAdapter;
import com.linkage.jz.bankruptcy.adapter.FullyGridLayoutManager;
import com.linkage.jz.bankruptcy.bean.ProCrDecInfo;
import com.linkage.jz.bankruptcy.bean.ProZQUserZQInfo;
import com.linkage.jz.bankruptcy.bean.TaskAtta;
import com.linkage.jz.bankruptcy.bean.ZQBaseInfo;
import com.linkage.jz.bankruptcy.bean.ZQBaseProjectCrDecInfo;
import com.linkage.jz.bankruptcy.bean.ZQUserDetailBaseInfo;
import com.linkage.jz.bankruptcy.event.RefreshEvent;
import com.linkage.jz.bankruptcy.net.BaseSubscriber;
import com.linkage.jz.bankruptcy.net.Network;
import com.linkage.jz.bankruptcy.utils.SPUtils;
import com.linkage.jz.bankruptcy.utils.Utils;
import com.linkage.jz.bankruptcy.widget.LoginNoticeDialog;
import com.linkage.jz.bankruptcy.widget.PublicCompareNoticeDialog;
import com.linkage.jz.bankruptcy.widget.ZQUserBaseReplyDialog;
import com.linkage.seapeak.activity.project.CreditorReviewDetailActivity;
import com.linkage.seapeak.activity.project.DissentAddActivity;
import com.linkage.seapeak.activity.project.EditCreditorReviewInfoActivity;
import com.linkage.seapeak.base.BaseFragment;
import com.linkage.seapeak.pojo.UploadImage;
import com.linkage.seapeak.utils.CommonUtils;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.Headers;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

import static com.linkage.jz.bankruptcy.utils.Utils.StringToLeng;

/**
 * @author FT
 * @time 2016-07-18 16:49
 * 债权人债权人详情 tab-债权详情
 */

// JUMP 
public class ZQZQUserZQBaseDetailFragment extends BaseFragment {
    RecyclerView mRecyclerView;
    private             Context     context;
    private             int         mPage;
    public static final String      MERCHANT_DETAILS_PAGE = "MERCHANT_DETAILS_PAGE";
    private             DemoAdapter mAdapter;
    private PublicCompareNoticeDialog publicCompareNoticeDialog;
    private boolean flag = false;

    private ZQUserBaseReplyDialog dialog;

    private static String mOnline;
    List<String> mFoodData;
    List<String> mMovieData;
    List<String> mHaveFunData;
    List<String> mEvaluationData;
    //    private static ZQUserInfo mInfo;
    private        TextView         tv_editname;
    private static String           creditorId;
    private static String           mProid;
    private static String           bigType;
    private        List<ZQBaseInfo> zqUserDetailInfo;
    private static String           mCreditorRightsId;
    private static Activity mActivity;

    private RecyclerView mImgRecyclerView4;
    private List<TaskAtta> mImgList4 = new ArrayList<>();
    private FileAdapter mImgAdapter4;

    private RecyclerView mImgRecyclerView1;
    private List<TaskAtta> mImgList1 = new ArrayList<>();
    private FileAdapter mImgAdapter1;

    private RecyclerView mImgRecyclerView2;
    private List<TaskAtta> mImgList2 = new ArrayList<>();
    private FileAdapter mImgAdapter2;


    private RecyclerView mImgRecyclerView3;
    private List<TaskAtta> mImgList3 = new ArrayList<>();
    private FileAdapter mImgAdapter3;

    private ProZQUserZQInfo proZQUserZQInfotmp;

    @Override
    public void onResume() {
        super.onResume();
        getData();
    }

    public static ZQZQUserZQBaseDetailFragment newInstance(int page, String creditorid, String proid, String creditorRightsId, Activity activity) {
        Bundle args = new Bundle();
        args.putInt(MERCHANT_DETAILS_PAGE, page);
        creditorId = creditorid;
        mActivity = activity;
//        mOnline = online;
        mCreditorRightsId = creditorRightsId;
        mProid = proid;
        ZQZQUserZQBaseDetailFragment tripFragment = new ZQZQUserZQBaseDetailFragment();
        tripFragment.setArguments(args);
        mOnline = BankruptcyApp.online;
        return tripFragment;
    }

    @Override
    public void onCreate( Bundle savedInstanceState ) {
        super.onCreate(savedInstanceState);
        mPage = getArguments().getInt(MERCHANT_DETAILS_PAGE);
        context = getActivity().getApplicationContext();
        zqUserDetailInfo = new ArrayList<ZQBaseInfo>();
        setData();
        EventBus.getDefault().register(this);
        getData();
    }



    @Nullable
    @Override
    public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState ) {
        View view = inflater.inflate(R.layout.fragment_zq_detail_base, container, false);
        mRecyclerView = (RecyclerView) view.findViewById(R.id.mRecyclerView);
        switch (mPage) {
            case 0:
                initAdapter(zqUserDetailInfo);
                break;

        }
        initAdapter(zqUserDetailInfo);

        //        tv_editname = vie

        return view;
    }


    private void setData() {
        mFoodData = new ArrayList<>();
        for (int i = 0; i < 1; i++) {
            mFoodData.add("美食" + i);
        }
        mMovieData = new ArrayList<>();
        for (int i = 0; i < 1; i++) {
            mMovieData.add("电影" + i);
        }
        mHaveFunData = new ArrayList<>();
        for (int i = 0; i < 1; i++) {
            mHaveFunData.add("玩乐" + i);
        }
        mEvaluationData = new ArrayList<>();
        for (int i = 0; i < 1; i++) {
            mEvaluationData.add("评价" + i);
        }
    }

    /**
     * 设置RecyclerView属性
     */
    private void initAdapter( List<ZQBaseInfo> data ) {
        //        mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LISTAL_LIST));

        mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
        mAdapter = new DemoAdapter(getActivity(), R.layout.fragment_zq_zqdetail_base_item_zq, data);
        mAdapter.openLoadAnimation();

        mRecyclerView.setAdapter(mAdapter);//设置adapter
        //设置item点击事件
        mAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
            @Override
            public void onItemChildClick( BaseQuickAdapter adapter, View view, int position ) {

                String crReviewId = "";
                String creditorRightsId ="";
                ZQBaseInfo proZQUserZQInfo = zqUserDetailInfo.get(position);

                switch (view.getId()) {

                    case R.id.btn_time_commit2:
//                        String bigtype = proZQUserZQInfo.get().getIdentityBigTypes().getValue();// 0表示企业，1表示自然债权人，2标识税务机关

                        CreateZQFristApplyActivity.start(getActivity(), creditorId, mProid, bigType, 1);
                        break;
                    case R.id.btn_commit:
                        //                        EditManagerUserInfoActivity.start(getActivity(),mInfo);
                        dialog = new ZQUserBaseReplyDialog(getActivity(), onClickListener);
                        dialog.show();
                        break;

                    case R.id.continue_fill_replenish_review:  //补充审查
                        crReviewId = "";
                        creditorRightsId = proZQUserZQInfo.getCreditorRightsId();
                        jumpEditInfoPage(proZQUserZQInfo, true,crReviewId,creditorRightsId);
                        break;
                    case R.id.bt_continue_fill_review: //继续填写审查意见
                        crReviewId = "";
                        creditorRightsId = proZQUserZQInfo.getCreditorRightsId();
                        jumpEditInfoPage(proZQUserZQInfo, false,crReviewId,creditorRightsId);
                        break;
                    case R.id.bt_dissent_review: //异议
                        DissentAddActivity.start(getActivity(), proZQUserZQInfo.getProjectCrDec().getCreditorId(), proZQUserZQInfo.getProjectCrDec().getBankruptcyProjectId(), proZQUserZQInfo.getCrReviewId(), 1);
                        break;
                    case R.id.bt_fill_review: //填写审查意见
                        //债权信息 在proZQUserZQInfo.ZQBaseProjectCrDecInfo中
                        //债权审核信息 在proZQUserZQInfo.ZQBaseProjectCrDecInfo.review中
                        //@ UU 这里，入口在这里，
                        crReviewId = "";
                        creditorRightsId = proZQUserZQInfo.getCreditorRightsId();
                        jumpEditInfoPage(proZQUserZQInfo, false,crReviewId,creditorRightsId);
                        break;
                    case R.id.look_replenish_review: //查看补充审查意见
                        //债权信息 在proZQUserZQInfo.ZQBaseProjectCrDecInfo中
                        //债权审核信息 在proZQUserZQInfo.ZQBaseProjectCrDecInfo.review中
                        //@ UU 这里，入口在这里，

                        crReviewId = proZQUserZQInfo.getCrReviewId();
                        creditorRightsId = proZQUserZQInfo.getCreditorRightsId();
                        jumpLookDetailPage(proZQUserZQInfo, 0, true,crReviewId,creditorRightsId);
                        break;
                    case R.id.bt_look_review: //查看审查意见
//                        jumpLookDetailPage(proZQUserZQInfo, 0, false);
                        //测试
                        crReviewId = proZQUserZQInfo.getCrReviewId();
                        creditorRightsId = proZQUserZQInfo.getCreditorRightsId();

                        if("".equalsIgnoreCase(crReviewId) &&"".equalsIgnoreCase(creditorRightsId))
                        {
                            creditorRightsId = proZQUserZQInfo.getProjectCrDec().getId();
                        }
                        jumpLookDetailPage(proZQUserZQInfo, 0, false,crReviewId,creditorRightsId);
                        break;
                    case R.id.bt_look_review_pre: //查看审查意见(前一次)
                        //这个审查id要用preVersion中的id
                        //projectCrDec.preVersion  creditorRightsId
                        //projectCrDec.preVersion.review  crReviewId
                        if(proZQUserZQInfo.getProjectCrDec().getPreVersion().getReview()!=null) {
                            crReviewId = proZQUserZQInfo.getProjectCrDec().getPreVersion().getReview().getId();
                        }
                        creditorRightsId = proZQUserZQInfo.getProjectCrDec().getPreVersion().getId();
                        jumpLookDetailPage(proZQUserZQInfo, 0, false,crReviewId,creditorRightsId);
                        break;
                    case R.id.bt_replenish_dec://补充申报
                        //                        jumpEditInfoPage(proZQUserZQInfo,true);
                        //                        String bigtype = proZQUserZQInfo.getType().getB().getValue();// 0表示企业，1表示自然债权人，2标识税务机关
                        //
                        CreateZQBCApplyActivity.start(getActivity(), proZQUserZQInfo.getProjectCrDec().getCreditorId(), proZQUserZQInfo.getProjectCrDec().getBankruptcyProjectId(),bigType , 1, proZQUserZQInfo.getProjectCrDec());
                        break;
                    case R.id.bt_replenish_review://补充审查
                        crReviewId = "";
                        creditorRightsId = proZQUserZQInfo.getCreditorRightsId();
                        jumpEditInfoPage(proZQUserZQInfo, true,crReviewId,creditorRightsId);
                        break;

                }
            }
        });

    }

    /**
     * 填写审查意见
     *
     * @param proZQUserZQInfo
     */
    /**
     * 填写审查意见
     *
     * @param proZQUserZQInfo
     */
    private void jumpEditInfoPage( ZQBaseInfo proZQUserZQInfo, boolean isReplenishOrReviewPage ,String crReviewId,String creditorRightsId) {
        Intent intent = new Intent(context, EditCreditorReviewInfoActivity.class);
        intent.putExtra(EditCreditorReviewInfoActivity.INTENT_IS_TAX_MODE, "2".equalsIgnoreCase(bigType));//true：税务，false： //非税务
        intent.putExtra(EditCreditorReviewInfoActivity.INTENT_IS_REPLENISH_REVIEW, isReplenishOrReviewPage);//true:补充 类型
        intent.putExtra(EditCreditorReviewInfoActivity.INTENT_ID_PROJECT, mProid);
//        String crReviewId = proZQUserZQInfo.getCrReviewId();
//        if ("".equalsIgnoreCase(crReviewId)) {
//            if (proZQUserZQInfo != null && proZQUserZQInfo.getProjectCrDec() != null && proZQUserZQInfo.getProjectCrDec().getPreVersion() != null&& proZQUserZQInfo.getProjectCrDec().getPreVersion().getReview()!=null) {
//                crReviewId = proZQUserZQInfo.getProjectCrDec().getPreVersion().getReview().getId();
//            }
//        }
        intent.putExtra(EditCreditorReviewInfoActivity.INTENT_ID_REVIEW, crReviewId);
        intent.putExtra(EditCreditorReviewInfoActivity.INTENT_ID_CREDITOR_RIGHTS,creditorRightsId);
        startActivity(intent);
    }

    /**
     * 查看审查意见
     *
     * @param proZQUserZQInfo
     */
    //todo 需要更改的参数可以自行添加
    private void jumpLookDetailPage( ZQBaseInfo proZQUserZQInfo, int type, boolean isReplenishOrReviewPage ,String crReviewId,String creditorRightsId) {
        Intent intent = new Intent(context, CreditorReviewDetailActivity.class);
        intent.putExtra(CreditorReviewDetailActivity.INTENT_IS_MANAGE_TYPE, false);//todo 需要标识判断
        intent.putExtra(CreditorReviewDetailActivity.INTENT_IS_TAX_MODE, "2".equalsIgnoreCase(bigType));//true：税务，false： //非税务
        intent.putExtra(CreditorReviewDetailActivity.INTENT_IS_REPLENISH_REVIEW, isReplenishOrReviewPage);//true:补充 类型
        intent.putExtra(CreditorReviewDetailActivity.INTENT_ID_PROJECT, mProid);
//        String crReviewId = "";
////
////
//        if (proZQUserZQInfo.getProjectCrDec().getPreVersion() != null && proZQUserZQInfo.getProjectCrDec().getPreVersion().getReview()!=null) {
//            crReviewId = proZQUserZQInfo.getProjectCrDec().getPreVersion().getReview().getId();
//        }
//        if ("".equalsIgnoreCase(crReviewId)) {
//            crReviewId = proZQUserZQInfo.getCrReviewId();
//        }
        intent.putExtra(CreditorReviewDetailActivity.INTENT_ID_REVIEW, crReviewId);
        intent.putExtra(CreditorReviewDetailActivity.INTENT_ID_CREDITOR_RIGHTS, creditorRightsId);
        int review = Integer.parseInt(proZQUserZQInfo.getProjectCrDec().getReviewStatus().getValue());
        if ("待发送".equalsIgnoreCase(proZQUserZQInfo.getProjectCrDec().getReviewStatus().getText())) {
            review = 3;
        }
        intent.putExtra(CreditorReviewDetailActivity.INTENT_REVIEW_STATUS, review);//todo 获取reviewStatus//1.重新生成
        startActivity(intent);
    }


    private View.OnClickListener onClickListener = new View.OnClickListener() {
        @Override
        public void onClick( View v ) {

            switch (v.getId()) {

                case R.id.btn_chancel:
                    dialog.dismiss();
                    break;
                case R.id.btn_save:
                    String msg = dialog.text_reason.getText().toString().trim();
                    String status = "1";
                    if (dialog.cb_nopass.isChecked()) {
                        status = "2";
                    }
                    String notifyTypes = "";
                    if (dialog.send_msg.isChecked() && dialog.send_phone.isChecked()) {
                        notifyTypes = "0,1";
                    } else if (dialog.send_msg.isChecked()) {
                        notifyTypes = "0";
                    } else {
                        notifyTypes = "1";
                    }


                    //                    addZQUser(name,phone);
                    applyPerson(status, msg, notifyTypes);
                    break;

            }
        }
    };

    public void applyPerson( String status, String msg, String notifyTypes ) {
        if (BankruptcyApp.tokeninfo == null || BankruptcyApp.tokeninfo.getToken() == null) {
            return;
        }

        OkHttpClient okHttpClient = new OkHttpClient();
        //        HashMap<String, String> params = new HashMap<String, String>();
        Random random    = new Random();
        String rom       = random.nextLong() + "";
        String timestamp = System.currentTimeMillis() + "";
        String userToken = SPUtils.getInstance(Consts.SPNAME).getString("userToken", "");
        String userId    = SPUtils.getInstance(Consts.SPNAME).getString("userId", "");

        RequestBody requestBody = new FormBody.Builder()
                .add("appid", Consts.appid)
                .add("nonce", rom)
                .add("timestamp", timestamp)
                .add("token", BankruptcyApp.tokeninfo.getToken())
                .add("userToken", userToken)
                .add("creditorId", creditorId)
                .add("status", status)
                .add("msg", msg)
                .add("notifyTypes", notifyTypes)
                .build();

        String url = Consts.WEBURL_INDENTITYAUDIT;
        Request request = new Request.Builder()
                .url(url)
                .post(requestBody)
                .build();

        okHttpClient.newCall(request).enqueue(new Callback() {
            @Override
            public void onFailure( Call call, IOException e ) {
                //                shapeLoadingDialog.dismiss();
                //                Log.d(TAG, "onFailure: " + e.getMessage());
                getActivity().runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        //更新UI

                    }

                });
            }

            @Override
            public void onResponse( Call call, Response response ) throws IOException {
                //                Log.d(TAG, response.protocol() + " " +response.code() + " " + response.message());
                Headers headers = response.headers();
                //

                String str = response.body().string();
                try {
                    final JSONObject object = new JSONObject(str);
                    if (object.optInt("code") == 0) {
                        getActivity().runOnUiThread(new Runnable() {

                            @Override
                            public void run() {
                                //更新UI
                                showToast("请求成功");

                            }

                        });
                        //                        finish();

                    } else {
                        getActivity().runOnUiThread(new Runnable() {

                            @Override
                            public void run() {
                                //更新UI

                                showToast("请求失败：" + object.optString("msg"));
                            }

                        });

                    }
                    str = "";
                } catch (Exception ex) {
                    ex.printStackTrace();
                    getActivity().runOnUiThread(new Runnable() {

                        @Override
                        public void run() {
                            //更新UI
                            showToast("请求失败：");

                        }

                    });
                }
            }
        });
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onEventMainThread(RefreshEvent event) {
        if (TextUtils.equals(event.getType(), RefreshEvent.ZQSHOWUNLINE)) {
            mOnline = "un";
//            Log.e("===================un=======", "");
        }
        if (TextUtils.equals(event.getType(), RefreshEvent.ZQSHOWONLINE)) {

//            Log.e("===================on=======", "");
            mOnline = "on";
        }
        mAdapter.notifyDataSetChanged();

    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        //在界面销毁的地方要解绑
        EventBus.getDefault().unregister(this);
    }

    /**
     * adapter
     */
    class DemoAdapter extends BaseQuickAdapter<ZQBaseInfo, BaseViewHolder> {
        int mLayoutId;

        public DemoAdapter( Context context, int LayoutId, List<ZQBaseInfo> info ) {
            super(LayoutId, info);
            mLayoutId = LayoutId;
        }


        @Override
        public void convert( BaseViewHolder helper, ZQBaseInfo info ) {
            helper.setGone(R.id.base_1, false);
            helper.setGone(R.id.base_2, false);
            helper.setGone(R.id.fragment_zq_zq_apply_base_item, false);



            ProZQUserZQInfo item = proZQUserZQInfotmp;
            if (info.getType() == 1) {

                helper.setVisible(R.id.time_base_1, false);
                helper.addOnClickListener(R.id.btn_time_commit2);
                long nowtime = System.currentTimeMillis() / 1000;
                if (item.getClaimFilingStartTime() == null || "null".equalsIgnoreCase(item.getClaimFilingStartTime()) || "".equalsIgnoreCase(item.getClaimFilingStartTime())) {
//                        helper.setGone(R.id.base_2,true);


                    helper.setVisible(R.id.fragment_zq_zq_apply_base_item, true);
                    helper.setVisible(R.id.time_base_3, true);
                    helper.setGone(R.id.ll_showTime, false);
                } else if (StringToLeng(item.getClaimFilingStartTime()) > nowtime) {
                    helper.setVisible(R.id.fragment_zq_zq_apply_base_item, true);
                    helper.setVisible(R.id.time_base_3, false);
                    helper.addOnClickListener(R.id.show_op);
                    helper.setVisible(R.id.show_op, true);

                    if (item.getClaimFilingEndTime() == null || "null".equalsIgnoreCase(item.getClaimFilingEndTime()) || "0".equalsIgnoreCase(item.getClaimFilingEndTime()) || "".equalsIgnoreCase(item.getClaimFilingStartTime())) {
                        helper.setText(R.id.tv_msg2, Utils.timeStamp2Date(StringToLeng(item.getClaimFilingStartTime()) * 1000, "yyyy-MM-dd HH:mm") + "-"
                                + "  ~,");
                    } else {
                        helper.setText(R.id.tv_msg2, Utils.timeStamp2Date(StringToLeng(item.getClaimFilingStartTime()) * 1000, "yyyy-MM-dd HH:mm") + "-"
                                + Utils.timeStamp2Date(StringToLeng(item.getClaimFilingEndTime()) * 1000, "yyyy-MM-dd HH:mm"));
                    }

                    long diffTime = StringToLeng(item.getClaimFilingStartTime()) - nowtime;
                    diffTime = diffTime * 1000;
                    long nd = 1000 * 24 * 60 * 60;// 一天的毫秒数
                    long nh = 1000 * 60 * 60;// 一小时的毫秒数
                    long nm = 1000 * 60;// 一分钟的毫秒数
                    long ns = 1000;// 一秒钟的毫秒数
                    long day = diffTime / nd;// 计算差多少天
                    long hour = diffTime % nd / nh;// 计算差多少小时
                    long min = diffTime % nd % nh / nm;// 计算差多少分钟
                    long sec = diffTime % nd % nh % nm / ns;// 计算差多少秒
                    // 输出结果
                    String strtime = "" + Math.abs(day) + "天" + Math.abs(hour) + "小时" + Math.abs(min)
                            + "分钟,";
//                        helper.setVisible(R.id.btn_commit2,true);
                    helper.setText(R.id.tv_msg3, strtime);
                    helper.setTextColor(R.id.tv_msg3, getResources().getColor(R.color.page_top));

                } else {
                    if (item.getClaimFilingEndTime() == null || "null".equalsIgnoreCase(item.getClaimFilingEndTime()) || "0".equalsIgnoreCase(item.getClaimFilingEndTime()) || "".equalsIgnoreCase(item.getClaimFilingStartTime())) {
                        helper.setVisible(R.id.fragment_zq_zq_apply_base_item, true);
                        helper.setVisible(R.id.show_op, true);
                        helper.addOnClickListener(R.id.show_op);
                        helper.setGone(R.id.time_base_3, false);
                        helper.setGone(R.id.tv_msg3_1, false);
                        helper.setGone(R.id.tv_msg3, false);
                        helper.setVisible(R.id.time_base_2, true);
                        helper.setVisible(R.id.btn_time_commit2, true);
                        helper.addOnClickListener(R.id.btn_time_commit2);
//                        helper.setVisible(R.id.btn_commit2, true);
                        if (item.getClaimFilingEndTime() == null || "null".equalsIgnoreCase(item.getClaimFilingEndTime()) || "0".equalsIgnoreCase(item.getClaimFilingEndTime()) || "".equalsIgnoreCase(item.getClaimFilingStartTime())) {
                            helper.setText(R.id.tv_msg2, Utils.timeStamp2Date(StringToLeng(item.getClaimFilingStartTime()) * 1000, "yyyy-MM-dd HH:mm") + "-"
                                    + "  ~,");
                        } else {
                            helper.setText(R.id.tv_msg2, Utils.timeStamp2Date(StringToLeng(item.getClaimFilingStartTime()) * 1000, "yyyy-MM-dd HH:mm") + "-"
                                    + Utils.timeStamp2Date(StringToLeng(item.getClaimFilingEndTime()) * 1000, "yyyy-MM-dd HH:mm"));
                        }

                        if (item.getClaimFilingEndTime() == null || "null".equalsIgnoreCase(item.getClaimFilingEndTime()) || "0".equalsIgnoreCase(item.getClaimFilingEndTime()) || "".equalsIgnoreCase(item.getClaimFilingStartTime())) {

                            if ("true".equalsIgnoreCase(item.hasCrDecTemp)) {
                                helper.setText(R.id.btn_time_commit2, "继续填写申报");
                            } else {
                                helper.setText(R.id.btn_time_commit2, "立即申报");
                            }

                        } else {
                            helper.setText(R.id.tv_msg3_1, "您已逾时未申报");
                            if ("true".equalsIgnoreCase(item.hasCrDecTemp)) {
                                helper.setText(R.id.btn_time_commit2, "继续填写申报");
                            } else {
                                helper.setText(R.id.btn_time_commit2, "逾时申报");
                            }
                        }
                        helper.addOnClickListener(R.id.btn_time_commit2);
                    } else {

                        if (StringToLeng(item.getClaimFilingEndTime()) > nowtime) {
                            helper.setVisible(R.id.fragment_zq_zq_apply_base_item, true);
                            helper.setVisible(R.id.show_op, true);
                            helper.addOnClickListener(R.id.show_op);
                            helper.setVisible(R.id.time_base_2, true);

                            helper.setText(R.id.tv_msg2, Utils.timeStamp2Date(StringToLeng(item.getClaimFilingStartTime()) * 1000, "yyyy-MM-dd HH:mm") + "-"
                                    + Utils.timeStamp2Date(StringToLeng(item.getClaimFilingEndTime()) * 1000, "yyyy-MM-dd HH:mm"));

                            long diffTime = StringToLeng(item.getClaimFilingEndTime()) - nowtime;
                            diffTime = diffTime * 1000;
                            long nd = 1000 * 24 * 60 * 60;// 一天的毫秒数
                            long nh = 1000 * 60 * 60;// 一小时的毫秒数
                            long nm = 1000 * 60;// 一分钟的毫秒数
                            long ns = 1000;// 一秒钟的毫秒数
                            long day = diffTime / nd;// 计算差多少天
                            long hour = diffTime % nd / nh;// 计算差多少小时
                            long min = diffTime % nd % nh / nm;// 计算差多少分钟
                            long sec = diffTime % nd % nh % nm / ns;// 计算差多少秒
                            // 输出结果
                            helper.setText(R.id.tv_msg3_1, "距离申报截止日还有");
                            String strtime = "" + Math.abs(day) + "天" + Math.abs(hour) + "小时" + Math.abs(min)
                                    + "分钟,";
                            helper.setVisible(R.id.btn_time_commit2, true);
                            helper.setText(R.id.tv_msg3, strtime);
                            helper.setTextColor(R.id.tv_msg3, getResources().getColor(R.color.page_top));
                        } else {

                            helper.setVisible(R.id.fragment_zq_zq_apply_base_item, true);
                            helper.setVisible(R.id.show_op, true);
                            helper.addOnClickListener(R.id.show_op);
//                                helper.setVisible(R.id.time_base_2,true);

                            String claimFilingEndTime = "";
                            if ("null".equalsIgnoreCase(item.getClaimFilingEndTime())) {
                                claimFilingEndTime = "待定";
                                helper.setText(R.id.tv_msg2, Utils.timeStamp2Date(StringToLeng(item.getClaimFilingStartTime()) * 1000, "yyyy-MM-dd HH:mm") + "-"
                                        + claimFilingEndTime);
                            } else {
                                helper.setText(R.id.tv_msg2, Utils.timeStamp2Date(StringToLeng(item.getClaimFilingStartTime()) * 1000, "yyyy-MM-dd HH:mm") + "-"
                                        + Utils.timeStamp2Date(StringToLeng(item.getClaimFilingEndTime()) * 1000, "yyyy-MM-dd HH:mm"));
                            }


                            long diffTime = StringToLeng(item.getClaimFilingEndTime()) - nowtime;

                            diffTime = diffTime * 1000;
                            long nd = 1000 * 24 * 60 * 60;// 一天的毫秒数
                            long nh = 1000 * 60 * 60;// 一小时的毫秒数
                            long nm = 1000 * 60;// 一分钟的毫秒数
                            long ns = 1000;// 一秒钟的毫秒数
                            long day = diffTime / nd;// 计算差多少天
                            long hour = diffTime % nd / nh;// 计算差多少小时
                            long min = diffTime % nd % nh / nm;// 计算差多少分钟
                            long sec = diffTime % nd % nh % nm / ns;// 计算差多少秒
                            // 输出结果

                            String strtime = "" + Math.abs(day) + "天" + Math.abs(hour) + "小时" + Math.abs(min)
                                    + "分钟,";
                            helper.setVisible(R.id.btn_time_commit2, true);
                            if ("null".equalsIgnoreCase(item.getClaimFilingEndTime())) {

                                if ("true".equalsIgnoreCase(item.hasCrDecTemp)) {
                                    helper.setText(R.id.btn_time_commit2, "继续填写申报");
                                } else {
                                    helper.setText(R.id.btn_time_commit2, "立即申报");
                                }

                            } else {
                                helper.setText(R.id.tv_msg3_1, "您已逾时未申报");
                                if ("true".equalsIgnoreCase(item.hasCrDecTemp)) {
                                    helper.setText(R.id.btn_time_commit2, "继续填写申报");
                                } else {
                                    helper.setText(R.id.btn_time_commit2, "逾时申报");
                                }
                            }
                            helper.addOnClickListener(R.id.btn_time_commit2);

                            helper.setText(R.id.tv_msg3, strtime);

                        }
                    }
                }
            }else {

                if (info.getTagButton() != null) {

                    ZQBaseProjectCrDecInfo proCrDecInfo = info.getProjectCrDec();
                    if ("on".equalsIgnoreCase(mOnline)) {
                        //隐藏
                        helper.setGone(R.id.show_unline, false);
                    } else {

                        //显示
                        helper.setGone(R.id.show_unline, true);
                    }

                    if (proCrDecInfo.getReviewStatus() != null && ("0".equalsIgnoreCase(proCrDecInfo.getReviewStatus().getValue())||"2".equalsIgnoreCase(proCrDecInfo.getReviewStatus().getValue()))) {
                        helper.setVisible(R.id.im_per_status, true);
//                        helper.setImageResource(R.id.im_per_status, R.drawable.icon_zanweishencha);
                        if(proCrDecInfo.getDeclareStatus() != null && "1".equalsIgnoreCase(proCrDecInfo.getDeclareStatus().getValue()))
                        {
                            helper.setImageResource(R.id.im_per_status, R.drawable.icon_bcsb);
                        }else {
                            helper.setImageResource(R.id.im_per_status, R.drawable.icon_zanweishencha);
                        }

                    } else {
                        helper.setVisible(R.id.im_per_status, false);
                    }
                    if ("2".equalsIgnoreCase(bigType)) {
                        if (proCrDecInfo.getReview()!=null && "true".equalsIgnoreCase(proCrDecInfo.getReview().getHasNoResponsesObje())) {
                            helper.setVisible(R.id.ll_feedback, true);
                            helper.addOnClickListener(R.id.ll_feedback);
                        } else {
                            helper.setGone(R.id.ll_feedback, false);
                        }
                        //                        helper.setVisible(R.id.fragment_zq_zq_info_tax_base_item, true);
//                        if (!"1".equalsIgnoreCase(proCrDecInfo.getDeclareStatus().getValue())) {
//                            if ("true".equalsIgnoreCase(proCrDecInfo.getReview().getHasNoResponsesObje())) {
//                                helper.setVisible(R.id.ll_feedback, true);
//                                helper.addOnClickListener(R.id.ll_feedback);
//                            } else {
//                                helper.setGone(R.id.ll_feedback, false);
//                            }
//                            helper.setVisible(R.id.fragment_zq_zq_info_tax_qr_base_item, true);
//                            //                            helper.setText(R.id.notax_qr_msg1, info.getCreditorName());
//                            float f = 0.00f;
//                            if ("".equalsIgnoreCase(proCrDecInfo.getDeclareAmountTotal())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getDeclareAmountTotal());
//                            }
//                            helper.setText(R.id.tax_qr_msg2, addComma(f+"")+"元");
//                            if ("".equalsIgnoreCase(proCrDecInfo.getReview().getConfirmedMoney())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getReview().getConfirmedMoney());
//                            }
//                            helper.setText(R.id.tax_qr_msg3, addComma(f+"")+"元");
//
//                            if ("".equalsIgnoreCase(proCrDecInfo.getReview().getRegularTaxMoney())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getReview().getRegularTaxMoney());
//                            }
//                            helper.setText(R.id.tax_qr_msg4,addComma(f+"")+"元");
//
//                            if ("".equalsIgnoreCase(proCrDecInfo.getReview().getOverdueFineMoney())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getReview().getOverdueFineMoney());
//                            }
//                            helper.setText(R.id.tax_qr_msg5, addComma(f+"")+"元");
//
//                            if ("".equalsIgnoreCase(proCrDecInfo.getReview().getOtherMoney())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getReview().getOtherMoney());
//                            }
//                            helper.setText(R.id.tax_qr_msg6, addComma(f+"")+"元");
//
//                            if ("".equalsIgnoreCase(proCrDecInfo.getReview().getDisconfirmationMoney())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getReview().getDisconfirmationMoney());
//                            }
//                            helper.setText(R.id.tax_qr_msg7, addComma(f+"")+"元");
//
//                            if ("".equalsIgnoreCase(proCrDecInfo.getReview().getUndeterminedMoney())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getReview().getUndeterminedMoney());
//                            }
//                            helper.setText(R.id.tax_qr_msg8,addComma(f+"")+"元");
//                        } else {
                        helper.setVisible(R.id.fragment_zq_zq_info_tax_base_item, true);
                        //                            helper.setText(R.id.notax_msg1, info.getCreditorName());
//                            float f = 0.00f;
//                            if ("".equalsIgnoreCase(proCrDecInfo.getDeclareAmountRegularTax())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getDeclareAmountRegularTax());
//                            }
                        helper.setText(R.id.tax_msg3, addComma(proCrDecInfo.getDeclareAmountRegularTax()+"")+"元");

                        if(proCrDecInfo.getPreVersion()!=null  && proCrDecInfo.getReviewStatus() != null && "0".equalsIgnoreCase(proCrDecInfo.getReviewStatus().getValue())
                                && proCrDecInfo.getDeclareStatus() != null && "1".equalsIgnoreCase(proCrDecInfo.getDeclareStatus().getValue()))
                        {
                            if(!proCrDecInfo.getPreVersion().getDeclareAmountRegularTax().equalsIgnoreCase(proCrDecInfo.getDeclareAmountRegularTax())
                                    && !"".equalsIgnoreCase(proCrDecInfo.getPreVersion().getDeclareAmountRegularTax()))
                            {
                                helper.setTextColor(R.id.tax_msg3, getResources().getColor(R.color.page_top));
                                helper.setVisible(R.id.tax_msg3_1,true);
                                TextView notax_msg3_1 = helper.getView(R.id.tax_msg3_1);
                                String curString = "正税："+addComma(proCrDecInfo.getDeclareAmountRegularTax()+"")+"元";
//                                    f = Float.parseFloat(proCrDecInfo.getDeclareAmountRegularTax());

                                if(!"".equalsIgnoreCase(proCrDecInfo.getPreVersion().getDeclareAmountRegularTax())) {
//                                        f = Float.parseFloat(proCrDecInfo.getPreVersion().getDeclareAmountRegularTax());
                                    String oldString = "正税：" + addComma(proCrDecInfo.getPreVersion().getDeclareAmountRegularTax() + "") + "元";
                                    notax_msg3_1.setOnClickListener(new View.OnClickListener() {
                                        @Override
                                        public void onClick(View v) {
                                            publicCompareNoticeDialog = new PublicCompareNoticeDialog(getActivity(), new View.OnClickListener() {
                                                @Override
                                                public void onClick(View v) {
                                                    if (v.getId() == R.id.ll_close) {
//                                        ChangerLegalRepActivity.start(getActivity(), info, "0", 0, 0);
                                                        publicCompareNoticeDialog.dismiss();
                                                    }

                                                }
                                            }, curString, oldString);
                                            publicCompareNoticeDialog.show();
                                        }
                                    });

                                }
                            }

                        }

//                            if ("".equalsIgnoreCase(proCrDecInfo.getDeclareAmountOverdueFine())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getDeclareAmountOverdueFine());
//                            }
                        helper.setText(R.id.tax_msg4, addComma(proCrDecInfo.getDeclareAmountOverdueFine()+"")+"元");

                        if(proCrDecInfo.getPreVersion()!=null && proCrDecInfo.getReviewStatus() != null && "0".equalsIgnoreCase(proCrDecInfo.getReviewStatus().getValue())
                                && proCrDecInfo.getDeclareStatus() != null && "1".equalsIgnoreCase(proCrDecInfo.getDeclareStatus().getValue()))
                        {
                            if(!proCrDecInfo.getPreVersion().getDeclareAmountOverdueFine().equalsIgnoreCase(proCrDecInfo.getDeclareAmountOverdueFine())
                                    && !"".equalsIgnoreCase(proCrDecInfo.getPreVersion().getDeclareAmountOverdueFine()))
                            {
                                helper.setTextColor(R.id.tax_msg4, getResources().getColor(R.color.page_top));
                                helper.setVisible(R.id.tax_msg4_1,true);
                                TextView notax_msg3_1 = helper.getView(R.id.tax_msg4_1);
                                String curString = "滞纳金："+addComma(proCrDecInfo.getPreVersion().getDeclareAmountOverdueFine()+"")+"元";
//                                    f = Float.parseFloat(proCrDecInfo.getDeclareAmountOverdueFine());

                                if(!"".equalsIgnoreCase(proCrDecInfo.getPreVersion().getDeclareAmountOverdueFine())) {
//                                        f = Float.parseFloat(proCrDecInfo.getPreVersion().getDeclareAmountOverdueFine());
                                    String oldString = "滞纳金：" + addComma(proCrDecInfo.getPreVersion().getDeclareAmountOverdueFine() + "") + "元";
                                    notax_msg3_1.setOnClickListener(new View.OnClickListener() {
                                        @Override
                                        public void onClick(View v) {
                                            publicCompareNoticeDialog = new PublicCompareNoticeDialog(getActivity(), new View.OnClickListener() {
                                                @Override
                                                public void onClick(View v) {
                                                    if (v.getId() == R.id.ll_close) {
//                                        ChangerLegalRepActivity.start(getActivity(), info, "0", 0, 0);
                                                        publicCompareNoticeDialog.dismiss();
                                                    }

                                                }
                                            }, curString, oldString);
                                            publicCompareNoticeDialog.show();
                                        }
                                    });
                                }

                            }

                        }

//                            if ("".equalsIgnoreCase(proCrDecInfo.getDeclareAmountOther())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getDeclareAmountOther());
//                            }
                        helper.setText(R.id.tax_msg5, addComma(proCrDecInfo.getDeclareAmountOther()+"")+"元");
                        if(proCrDecInfo.getPreVersion()!=null && proCrDecInfo.getReviewStatus() != null && "0".equalsIgnoreCase(proCrDecInfo.getReviewStatus().getValue())
                                && proCrDecInfo.getDeclareStatus() != null && "1".equalsIgnoreCase(proCrDecInfo.getDeclareStatus().getValue()))
                        {
                            if(!proCrDecInfo.getPreVersion().getDeclareAmountOther().equalsIgnoreCase(proCrDecInfo.getDeclareAmountOther())
                                    && !"".equalsIgnoreCase(proCrDecInfo.getPreVersion().getDeclareAmountOther()))
                            {
                                helper.setTextColor(R.id.tax_msg5, getResources().getColor(R.color.page_top));
                                helper.setVisible(R.id.tax_msg5_1,true);
                                TextView notax_msg3_1 = helper.getView(R.id.tax_msg5_1);
                                String curString = "其他："+addComma(proCrDecInfo.getDeclareAmountOther()+"")+"元";
//                                    f = Float.parseFloat(proCrDecInfo.getDeclareAmountOther());

                                if(!"".equalsIgnoreCase(proCrDecInfo.getPreVersion().getDeclareAmountOther())) {
//                                        f = Float.parseFloat(proCrDecInfo.getPreVersion().getDeclareAmountOther());
                                    String oldString = "其他：" + addComma(proCrDecInfo.getPreVersion().getDeclareAmountOther() + "") + "元";
                                    notax_msg3_1.setOnClickListener(new View.OnClickListener() {
                                        @Override
                                        public void onClick(View v) {
                                            publicCompareNoticeDialog = new PublicCompareNoticeDialog(getActivity(), new View.OnClickListener() {
                                                @Override
                                                public void onClick(View v) {
                                                    if (v.getId() == R.id.ll_close) {
//                                        ChangerLegalRepActivity.start(getActivity(), info, "0", 0, 0);
                                                        publicCompareNoticeDialog.dismiss();
                                                    }

                                                }
                                            }, curString, oldString);
                                            publicCompareNoticeDialog.show();
                                        }
                                    });
                                }

                            }

                        }


//                            if ("".equalsIgnoreCase(proCrDecInfo.getDeclareAmountTotal())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getDeclareAmountTotal());
//                            }
                        helper.setText(R.id.tax_msg2,addComma(proCrDecInfo.getDeclareAmountTotal()+"")+"元");

//                            if ("".equalsIgnoreCase(proCrDecInfo.getDeclareAmountInterestDetail())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getDeclareAmountInterestDetail());
//                            }
                        helper.setText(R.id.tax_msg6, proCrDecInfo.getDeclareAmountInterestDetail());

//                            if ("".equalsIgnoreCase(proCrDecInfo.getDeclareAmountOtherDetail())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getDeclareAmountOtherDetail());
//                            }
                        helper.setText(R.id.tax_msg7, proCrDecInfo.getDeclareAmountOtherDetail());
//                        }
                        helper.setVisible(R.id.base_2, true);
                        //优先主张说明
                        helper.setGone(R.id.frist_desc,false);
                    }
                    else //非税务
                    {
                        //优先主张说明
                        helper.setGone(R.id.frist_desc,true);
                        if (proCrDecInfo.getReview()!=null && "true".equalsIgnoreCase(proCrDecInfo.getReview().getHasNoResponsesObje())) {
                            helper.setVisible(R.id.ll_feedback, true);
                            helper.addOnClickListener(R.id.ll_feedback);
                        } else {
                            helper.setGone(R.id.ll_feedback, false);
                        }
//                        if ("1".equalsIgnoreCase(proCrDecInfo.getReviewStatus().getValue())) {
//                            if ("true".equalsIgnoreCase(proCrDecInfo.getReview().getHasNoResponsesObje())) {
//                                helper.setVisible(R.id.ll_feedback, true);
//                                helper.addOnClickListener(R.id.ll_feedback);
//                            } else {
//                                helper.setGone(R.id.ll_feedback, false);
//                            }
//                            helper.setVisible(R.id.fragment_zq_zq_info_notax_qr_base_item, true);
//                            helper.setText(R.id.notax_qr_msg1, "");
//                            //                                helper.setText(R.id.notax_qr_msg2, info.getDeclareAmountTotal());
////                            helper.setText(R.id.notax_qr_msg3, proCrDecInfo.getReview().getConfirmedMoney());
////                            helper.setText(R.id.notax_qr_msg4, proCrDecInfo.getReview().getOrdinaryMoney());
////                            helper.setText(R.id.notax_qr_msg5, proCrDecInfo.getReview().getGuaranteePriority());
////                            helper.setText(R.id.notax_qr_msg6, proCrDecInfo.getReview().getOtherPriorityMoney());
////                            helper.setText(R.id.notax_qr_msg7, proCrDecInfo.getReview().getDisconfirmationMoney());
////                            helper.setText(R.id.notax_qr_msg8, proCrDecInfo.getReview().getUndeterminedMoney());
//
//                            float f = 0.00f;
//                            if ("".equalsIgnoreCase(proCrDecInfo.getDeclareAmountPrincipal())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getDeclareAmountPrincipal());
//                            }
//                            helper.setText(R.id.notax_qr_msg1, f + " 元");
//                            if ("".equalsIgnoreCase(proCrDecInfo.getDeclareAmountInterest())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getDeclareAmountInterest());
//                            }
//                            helper.setText(R.id.notax_qr_msg2, f + " 元");
//                            if ("".equalsIgnoreCase(proCrDecInfo.getDeclareAmountOther())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getDeclareAmountOther());
//                            }
//                            helper.setText(R.id.notax_qr_msg3, f + " 元");
//                            if ("".equalsIgnoreCase(proCrDecInfo.getDeclareAmountTotal())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getDeclareAmountTotal());
//                            }
//                            helper.setText(R.id.notax_qr_msg4, f + " 元");
//                            helper.setText(R.id.notax_qr_msg5, proCrDecInfo.getDeclareAmountInterestDetail());
//
//                            helper.setText(R.id.notax_qr_msg6, proCrDecInfo.getDeclareAmountOtherDetail());
////                            if ("".equalsIgnoreCase(proCrDecInfo.getGuaranteePriority())) {
////                                f = 0.00f;
////                            } else {
////                                f = Float.parseFloat(proCrDecInfo.getGuaranteePriority());
////                            }
////                            helper.setText(R.id.notax_qr_msg7, f + " 元");
////                            if ("".equalsIgnoreCase(proCrDecInfo.getOtherPriority())) {
////                                f = 0.00f;
////                            } else {
////                                f = Float.parseFloat(proCrDecInfo.getOtherPriority());
////                            }
////
////                            helper.setText(R.id.notax_qr_msg8, f + " 元");
////                            helper.setText(R.id.notax_qr_msg9, proCrDecInfo.getPreferredCreditorRightsDetail());
//                        } else {
                        helper.setVisible(R.id.fragment_zq_zq_info_notax_base_item, true);
                        //                                helper.setVisible(R.id.fragment_zq_zq_info_notax_base_item, true);
                        //                                helper.setText(R.id.notax_msg1, info.getCreditorName());
//                            float f = 0.00f;
//                            if ("".equalsIgnoreCase(proCrDecInfo.getDeclareAmountPrincipal())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getDeclareAmountPrincipal());
//                            }
                        helper.setText(R.id.notax_msg3, addComma(proCrDecInfo.getDeclareAmountPrincipal()+"")+"元");

                        if(proCrDecInfo.getPreVersion()!=null && proCrDecInfo.getReviewStatus() != null && "0".equalsIgnoreCase(proCrDecInfo.getReviewStatus().getValue())
                                && proCrDecInfo.getDeclareStatus() != null && "1".equalsIgnoreCase(proCrDecInfo.getDeclareStatus().getValue()))
                        {
                            if(!proCrDecInfo.getPreVersion().getDeclareAmountPrincipal().equalsIgnoreCase(proCrDecInfo.getDeclareAmountPrincipal())
                                    && !"".equalsIgnoreCase(proCrDecInfo.getPreVersion().getDeclareAmountPrincipal()))
                            {
                                helper.setTextColor(R.id.notax_msg3, getResources().getColor(R.color.page_top));
                                helper.setVisible(R.id.notax_msg3_1,true);
                                TextView notax_msg3_1 = helper.getView(R.id.notax_msg3_1);
                                String curString = "本金："+addComma(proCrDecInfo.getPreVersion().getDeclareAmountPrincipal()+"")+"元";
//                                    f = Float.parseFloat(proCrDecInfo.getDeclareAmountPrincipal());


                                if(!"".equalsIgnoreCase(proCrDecInfo.getPreVersion().getDeclareAmountPrincipal())) {
//                                        f = Float.parseFloat(proCrDecInfo.getPreVersion().getDeclareAmountPrincipal());
                                    String oldString = "本金：" + addComma(proCrDecInfo.getPreVersion().getDeclareAmountPrincipal() + "") + "元";
                                    notax_msg3_1.setOnClickListener(new View.OnClickListener() {
                                        @Override
                                        public void onClick(View v) {
                                            publicCompareNoticeDialog = new PublicCompareNoticeDialog(getActivity(), new View.OnClickListener() {
                                                @Override
                                                public void onClick(View v) {
                                                    if (v.getId() == R.id.ll_close) {
//                                        ChangerLegalRepActivity.start(getActivity(), info, "0", 0, 0);
                                                        publicCompareNoticeDialog.dismiss();
                                                    }

                                                }
                                            }, curString, oldString);
                                            publicCompareNoticeDialog.show();
                                        }
                                    });
                                }

                            }

                        }
//                            if ("".equalsIgnoreCase(proCrDecInfo.getDeclareAmountInterest())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getDeclareAmountInterest());
//                            }
                        helper.setText(R.id.notax_msg4, addComma(proCrDecInfo.getDeclareAmountInterest()+"")+"元");

                        if(proCrDecInfo.getPreVersion()!=null  && proCrDecInfo.getReviewStatus() != null && "0".equalsIgnoreCase(proCrDecInfo.getReviewStatus().getValue())
                                && proCrDecInfo.getDeclareStatus() != null && "1".equalsIgnoreCase(proCrDecInfo.getDeclareStatus().getValue()))
                        {
                            if(!proCrDecInfo.getPreVersion().getDeclareAmountInterest().equalsIgnoreCase(proCrDecInfo.getDeclareAmountInterest())
                                    && !"".equalsIgnoreCase(proCrDecInfo.getPreVersion().getDeclareAmountInterest()))
                            {
                                helper.setTextColor(R.id.notax_msg4, getResources().getColor(R.color.page_top));
                                helper.setVisible(R.id.notax_msg4_1,true);
                                TextView notax_msg3_1 = helper.getView(R.id.notax_msg4_1);
                                String curString = "利息："+addComma(proCrDecInfo.getDeclareAmountInterest()+"")+"元";
//                                    f = Float.parseFloat(proCrDecInfo.getDeclareAmountInterest());


                                if(!"".equalsIgnoreCase(proCrDecInfo.getPreVersion().getDeclareAmountInterest())) {
//                                        f = Float.parseFloat(proCrDecInfo.getPreVersion().getDeclareAmountInterest());
                                    String oldString = "利息：" + addComma(proCrDecInfo.getPreVersion().getDeclareAmountInterest() + "") + "元";
                                    notax_msg3_1.setOnClickListener(new View.OnClickListener() {
                                        @Override
                                        public void onClick(View v) {
                                            publicCompareNoticeDialog = new PublicCompareNoticeDialog(getActivity(), new View.OnClickListener() {
                                                @Override
                                                public void onClick(View v) {
                                                    if (v.getId() == R.id.ll_close) {
//                                        ChangerLegalRepActivity.start(getActivity(), info, "0", 0, 0);
                                                        publicCompareNoticeDialog.dismiss();
                                                    }

                                                }
                                            }, curString, oldString);
                                            publicCompareNoticeDialog.show();
                                        }
                                    });
                                }

                            }

                        }


//                            if ("".equalsIgnoreCase(proCrDecInfo.getDeclareAmountOther())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getDeclareAmountOther());
//                            }
                        helper.setText(R.id.notax_msg5,addComma(proCrDecInfo.getDeclareAmountOther()+"")+"元");

                        if(proCrDecInfo.getPreVersion()!=null  && proCrDecInfo.getReviewStatus() != null && "0".equalsIgnoreCase(proCrDecInfo.getReviewStatus().getValue())
                                && proCrDecInfo.getDeclareStatus() != null && "1".equalsIgnoreCase(proCrDecInfo.getDeclareStatus().getValue()))
                        {
                            if(!proCrDecInfo.getPreVersion().getDeclareAmountOther().equalsIgnoreCase(proCrDecInfo.getDeclareAmountOther())
                                    && !"".equalsIgnoreCase(proCrDecInfo.getPreVersion().getDeclareAmountOther()))
                            {
                                helper.setTextColor(R.id.notax_msg5, getResources().getColor(R.color.page_top));
                                helper.setVisible(R.id.notax_msg5_1,true);
                                TextView notax_msg3_1 = helper.getView(R.id.notax_msg5_1);
                                String curString = "其他："+addComma(proCrDecInfo.getDeclareAmountOther()+"")+"元";
//                                    f = Float.parseFloat(proCrDecInfo.getDeclareAmountOther());

                                if(!"".equalsIgnoreCase(proCrDecInfo.getPreVersion().getDeclareAmountOther())) {
//                                        f = Float.parseFloat(proCrDecInfo.getPreVersion().getDeclareAmountOther());
                                    String oldString = "其他：" + addComma(proCrDecInfo.getPreVersion().getDeclareAmountOther() + "") + "元";
                                    notax_msg3_1.setOnClickListener(new View.OnClickListener() {
                                        @Override
                                        public void onClick(View v) {
                                            publicCompareNoticeDialog = new PublicCompareNoticeDialog(getActivity(), new View.OnClickListener() {
                                                @Override
                                                public void onClick(View v) {
                                                    if (v.getId() == R.id.ll_close) {
//                                        ChangerLegalRepActivity.start(getActivity(), info, "0", 0, 0);
                                                        publicCompareNoticeDialog.dismiss();
                                                    }

                                                }
                                            }, curString, oldString);
                                            publicCompareNoticeDialog.show();
                                        }
                                    });

                                }
                            }

                        }

//                            if ("".equalsIgnoreCase(proCrDecInfo.getDeclareAmountTotal())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getDeclareAmountTotal());
//                            }
                        helper.setText(R.id.notax_msg2,addComma(proCrDecInfo.getDeclareAmountTotal()+"")+"元");
//                            if ("".equalsIgnoreCase(proCrDecInfo.getDeclareAmountInterestDetail())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getDeclareAmountInterestDetail());
//                            }
                        helper.setText(R.id.notax_msg6, proCrDecInfo.getDeclareAmountInterestDetail());
//                            if ("".equalsIgnoreCase(proCrDecInfo.getDeclareAmountOtherDetail())) {
//                                f = 0.00f;
//                            } else {
//                                f = Float.parseFloat(proCrDecInfo.getDeclareAmountOtherDetail());
//                            }
                        helper.setText(R.id.notax_msg7,proCrDecInfo.getDeclareAmountOtherDetail());
//                        }
                        helper.setVisible(R.id.base_2, true);
                        //                        }
                    }
                    mImgRecyclerView2 = (RecyclerView) helper.getView(R.id.recycler2);
                    mImgRecyclerView2.setNestedScrollingEnabled(false);

                    mImgAdapter2 = new FileAdapter(getActivity(), mImgList2);
                    mImgRecyclerView2.setLayoutManager(mImgAdapter2.createLayoutManager());
                    mImgRecyclerView2.setAdapter(mImgAdapter2);
                    mImgList2.clear();

                    if (proCrDecInfo.getJudgmentAtta() != null) {
                        mImgList2.addAll(proCrDecInfo.getJudgmentAtta());

                    }


//                    mImgRecyclerView2 = (RecyclerView) helper.getView(R.id.recycler2);
//                    mImgRecyclerView2.setNestedScrollingEnabled(false);
//                    FullyGridLayoutManager manager1 = new FullyGridLayoutManager(getActivity(), 4, GridLayoutManager.VERTICAL, false);
//                    mImgRecyclerView2.setLayoutManager(manager1);
//                    mImgList2.clear();
//                    mImgAdapter2 = new GridImagesAdapter(mActivity, TYPE_PREVIEW);
//                    mImgAdapter2.setList(mImgList2);
//                    mImgRecyclerView2.setAdapter(mImgAdapter2);
//
//                    if(proCrDecInfo.getJudgmentAtta()!=null) {
//                        for (int i = 0; i < proCrDecInfo.getJudgmentAtta().size(); i++) {
//                            TaskAtta atta = proCrDecInfo.getJudgmentAtta().get(i);
//                            JSONObject obj = new JSONObject();
//                            try {
//                                obj.putOpt("filename", atta.getAttachmentName());
//                                obj.putOpt("filepath", atta.getAttachmentDownloadAddress());
//                                obj.putOpt("filesize", atta.getAttachmentSize());
//                                obj.putOpt("loadUrl", atta.getAttachmentWatermarkAddress());
//                                mImgList2.add(new Gson().fromJson(obj.toString(), UploadImage.class));
//                            } catch (JSONException e) {
//                                e.printStackTrace();
//                            }
//                        }
//                    }

                    mImgRecyclerView3 = (RecyclerView) helper.getView(R.id.recycler3);
                    mImgRecyclerView3.setNestedScrollingEnabled(false);

                    mImgAdapter3 = new FileAdapter(getActivity(), mImgList3);
                    mImgRecyclerView3.setLayoutManager(mImgAdapter3.createLayoutManager());
                    mImgRecyclerView3.setAdapter(mImgAdapter3);
                    mImgList3.clear();

                    if (proCrDecInfo.getExecutionAtta() != null) {
                        mImgList3.addAll(proCrDecInfo.getExecutionAtta());

                    }

//                    mImgRecyclerView3 = (RecyclerView) helper.getView(R.id.recycler3);
//                    mImgRecyclerView3.setNestedScrollingEnabled(false);
//                    FullyGridLayoutManager manager2 = new FullyGridLayoutManager(getActivity(), 4, GridLayoutManager.VERTICAL, false);
//                    mImgRecyclerView3.setLayoutManager(manager2);
//                    mImgList3.clear();
//                    mImgAdapter3 = new GridImagesAdapter(mActivity, TYPE_PREVIEW);
//                    mImgAdapter3.setList(mImgList3);
//                    mImgRecyclerView3.setAdapter(mImgAdapter3);
//
//                    if(proCrDecInfo.getExecutionAtta()!=null) {
//                        for (int i = 0; i < proCrDecInfo.getExecutionAtta().size(); i++) {
//                            TaskAtta atta = proCrDecInfo.getExecutionAtta().get(i);
//                            JSONObject obj = new JSONObject();
//                            try {
//                                obj.putOpt("filename", atta.getAttachmentName());
//                                obj.putOpt("filepath", atta.getAttachmentDownloadAddress());
//                                obj.putOpt("filesize", atta.getAttachmentSize());
//                                obj.putOpt("loadUrl", atta.getAttachmentWatermarkAddress());
//                                mImgList3.add(new Gson().fromJson(obj.toString(), UploadImage.class));
//                            } catch (JSONException e) {
//                                e.printStackTrace();
//                            }
//                        }
//                    }

                    helper.setText(R.id.tv_recycler3_desc,"说明："+proCrDecInfo.getExecutiveDetail());

                    mImgRecyclerView4 = (RecyclerView) helper.getView(R.id.recycler4);
                    mImgRecyclerView4.setNestedScrollingEnabled(false);

                    mImgAdapter4 = new FileAdapter(getActivity(), mImgList4);
                    mImgRecyclerView4.setLayoutManager(mImgAdapter4.createLayoutManager());
                    mImgRecyclerView4.setAdapter(mImgAdapter4);
                    mImgList4.clear();

                    if (proCrDecInfo.getJudgmentAtta() != null) {
                        mImgList4.addAll(proCrDecInfo.getJudgmentAtta());

                    }

                    helper.setText(R.id.tv_zqdesc,proCrDecInfo.getCreditorRightsNote());

                    if(proCrDecInfo.getPreVersion()!=null && proCrDecInfo.getReviewStatus() != null && "0".equalsIgnoreCase(proCrDecInfo.getReviewStatus().getValue())
                            && proCrDecInfo.getDeclareStatus() != null && "1".equalsIgnoreCase(proCrDecInfo.getDeclareStatus().getValue())) {
                        if (!proCrDecInfo.getPreVersion().getCreditorRightsNote().equalsIgnoreCase(proCrDecInfo.getCreditorRightsNote())) {
                            helper.setTextColor(R.id.notax_msg4, getResources().getColor(R.color.page_top));
                            helper.setVisible(R.id.tv_zqdesc_1, true);
                            TextView notax_msg3_1 = helper.getView(R.id.tv_zqdesc_1);
                            String curString = "债权描述：" + proCrDecInfo.getCreditorRightsNote();
//                                   String curString = "proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()";
                            String oldString = "债权描述：" + proCrDecInfo.getPreVersion().getCreditorRightsNote();
//                                   String oldString = "proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()proCrDecInfo.getPreVersion().getCreditorRightsNote()";

                            notax_msg3_1.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    publicCompareNoticeDialog = new PublicCompareNoticeDialog(getActivity(), new View.OnClickListener() {
                                        @Override
                                        public void onClick(View v) {
                                            if (v.getId() == R.id.ll_close) {
//                                        ChangerLegalRepActivity.start(getActivity(), info, "0", 0, 0);
                                                publicCompareNoticeDialog.dismiss();
                                            }

                                        }
                                    }, curString, oldString);
                                    publicCompareNoticeDialog.show();
                                }
                            });

                        }
                    }
                    helper.setText(R.id.tv_zqbzsm,proCrDecInfo.getSupplementExplain());

                    //补充信息
                    if(!"1".equalsIgnoreCase(proCrDecInfo.getDeclareStatus().getValue()))
                    {
                        helper.setGone(R.id.ll_bc_desc,false);
                    }else{
                        helper.setGone(R.id.ll_bc_desc,true);
                        helper.setText(R.id.tv_zqbzsm,proCrDecInfo.getSupplementExplain());
                    }

                    if("".equalsIgnoreCase(proCrDecInfo.getGuaranteePriority()) && "".equalsIgnoreCase(proCrDecInfo.getOtherPriority())
                            && "".equalsIgnoreCase(proCrDecInfo.getPreferredCreditorRightsDetail()))
                    {
                        helper.setGone(R.id.ll_frist1,false);
                        helper.setGone(R.id.ll_frist2,false);
                        helper.setGone(R.id.ll_frist3,false);
                    }else{
                        helper.setVisible(R.id.ll_frist1,true);
                        helper.setVisible(R.id.ll_frist2,true);
                        helper.setVisible(R.id.ll_frist3,true);

                        if(!"".equalsIgnoreCase(proCrDecInfo.getGuaranteePriority())) {
                            helper.setText(R.id.tv_frist1, proCrDecInfo.getGuaranteePriority()+"元");
                        }else{
                            helper.setText(R.id.tv_frist1, "无");
                        }
                        if(!"".equalsIgnoreCase(proCrDecInfo.getOtherPriority())) {
                            helper.setText(R.id.tv_frist2, proCrDecInfo.getOtherPriority()+"元");
                        }else{
                            helper.setText(R.id.tv_frist2, "无");
                        }
                        if(!"".equalsIgnoreCase(proCrDecInfo.getPreferredCreditorRightsDetail())) {
                            helper.setText(R.id.tv_frist3, proCrDecInfo.getPreferredCreditorRightsDetail());
                        }else{

                            helper.setText(R.id.tv_frist3, "无");

                        }
                    }

                    helper.setGone(R.id.continue_fill_replenish_review, false);
                    helper.setGone(R.id.bt_continue_fill_review, false);
                    helper.setGone(R.id.bt_dissent_review, false);
                    helper.setGone(R.id.bt_fill_review, false);
                    helper.setGone(R.id.look_replenish_review, false);
                    helper.setGone(R.id.bt_look_review, false);
                    helper.setGone(R.id.bt_look_review_pre, false);
                    helper.setGone(R.id.bt_replenish_dec, false);
                    helper.setGone(R.id.bt_replenish_review, false);

                    if (info.getTagButton().getContinue_fill_replenish_review() != null && !"".equalsIgnoreCase(info.getTagButton().getContinue_fill_replenish_review())) {
                        helper.setVisible(R.id.continue_fill_replenish_review, true);
                        helper.addOnClickListener(R.id.continue_fill_replenish_review);
                    }


                    if (info.getTagButton().getContinue_fill_review() != null && !"".equalsIgnoreCase(info.getTagButton().getContinue_fill_review())) {
                        helper.setVisible(R.id.bt_continue_fill_review, true);
                        helper.addOnClickListener(R.id.bt_continue_fill_review);
                    }

                    if (info.getTagButton().getDissent_review() != null && !"".equalsIgnoreCase(info.getTagButton().getDissent_review())) {
                        helper.setVisible(R.id.bt_dissent_review, true);
                        helper.addOnClickListener(R.id.bt_dissent_review);
                    }

                    if (info.getTagButton().getFill_review() != null && !"".equalsIgnoreCase(info.getTagButton().getFill_review())) {
                        helper.setVisible(R.id.bt_fill_review, true);
                        helper.addOnClickListener(R.id.bt_fill_review);
                    }

                    if (info.getTagButton().getLook_replenish_review() != null && !"".equalsIgnoreCase(info.getTagButton().getLook_replenish_review())) {
                        helper.setVisible(R.id.look_replenish_review, true);
                        helper.addOnClickListener(R.id.look_replenish_review);
                    }

                    if (info.getTagButton().getLook_review() != null && !"".equalsIgnoreCase(info.getTagButton().getLook_review())) {
                        helper.setVisible(R.id.bt_look_review, true);
                        helper.addOnClickListener(R.id.bt_look_review);
                    }

                    if (info.getTagButton().getLook_review_pre() != null && !"".equalsIgnoreCase(info.getTagButton().getLook_review_pre())) {
                        helper.setVisible(R.id.bt_look_review_pre, true);
                        helper.addOnClickListener(R.id.bt_look_review_pre);
                    }
                    if (info.getTagButton().getReplenish_dec() != null && !"".equalsIgnoreCase(info.getTagButton().getReplenish_dec())) {
                        helper.setVisible(R.id.bt_replenish_dec, true);
                        helper.addOnClickListener(R.id.bt_replenish_dec);
                    }

                    if (info.getTagButton().getReplenish_review() != null && !"".equalsIgnoreCase(info.getTagButton().getReplenish_review())) {
                        helper.setVisible(R.id.bt_replenish_review, true);
                        helper.addOnClickListener(R.id.bt_replenish_review);
                    }
                }
            }

            //            if("2".equalsIgnoreCase(info.getProcessStatus().getValue()))
            //            {
            //                helper.setVisible(R.id.bt_apply,false);
            //
            //            }
            //
            //            if("3".equalsIgnoreCase(info.getProcessStatus().getValue()))
            //            {
            //                helper.setVisible(R.id.base_2,true);
            //                helper.setText(R.id.bt_apply,"填写审查意见");
            //            }
            //
            //            if("4".equalsIgnoreCase(info.getProcessStatus().getValue()))
            //            {
            //
            //                helper.setText(R.id.bt_apply,"查看审查意见");
            //                helper.setVisible(R.id.base_2,true);
            //
            //            }


        }
    }

    public void getData() { String userToken = SPUtils.getInstance(Consts.SPNAME).getString("userToken", "");
        if(flag)
        {
            return;
        }

        flag = true;
        //        Map<String, String> parms = new HashMap<>();
        //        parms.put("userToken", userToken);
        //        parms.put("projectId", proid);
        //
        //        if(type ==1 )
        //        {
        //            parms.put("creditorId", data);
        //        }else if(type ==2)
        //        {
        //            parms.put("creditorRightsId", data);
        //        }else{
        //            parms.put("crRevObjeId", data);
        //        }
        Network
                .getAPIService()
                .creditorInfo(userToken, mProid, creditorId, 1)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscriber<JsonObject>() {
                    @Override
                    public void onNext( JsonObject json ) {
                        int code = json.get("code").getAsInt();
                        if (code != 0) {
                            flag = false;
                            super.onNext(json);
                            return;
                        }

                        JsonObject data = json.getAsJsonObject("data");

                        /*
                           opStatus:0   //     取值:0: 只有名称没有电话号码时
                        1: 通知进程中、身份验证中
                        2: 暂未申报
                        3: 暂未审查
                        4: 未有确认债权
                        5: 已确认|未有确认债权（初次审查完成）
                        6: 已确认|未有确认债权（补充申报管理人审查前）
                        7: 已确认|未有确认债权（补充申报管理人已审查）
                 */
                        final ZQUserDetailBaseInfo info = new Gson().fromJson(data.getAsJsonObject("creditorInfo"), ZQUserDetailBaseInfo.class);

                        String opStatus = data.get("opStatus").getAsString();


                        if ("2".equalsIgnoreCase(opStatus)) {

                            getActivity().runOnUiThread(new Runnable() {

                                @Override
                                public void run() {
//                                    getSubData(1);
                                    bigType = info.getIdentityBigTypes().getValue();
                                    getDatatmp();
                                    mAdapter.notifyDataSetChanged();
                                }

                            });

                        } else if ("3".equalsIgnoreCase(opStatus) || "4".equalsIgnoreCase(opStatus) || "5".equalsIgnoreCase(opStatus)
                                || "6".equalsIgnoreCase(opStatus) || "7".equalsIgnoreCase(opStatus)) {
                            getActivity().runOnUiThread(new Runnable() {

                                @Override
                                public void run() {
                                    bigType = info.getIdentityBigTypes().getValue();
                                    getSubData(2);
                                }

                            });
                        }


                    }

                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError( Throwable e ) {
                        flag = false;
                    }
                });
    }


    public void getSubData(final int type) {
        if (BankruptcyApp.tokeninfo == null || BankruptcyApp.tokeninfo.getToken() == null) {
            return;
        }
        //        shapeLoadingDialog.setLoadingText("加载中...");
        //        shapeLoadingDialog.setCanceledOnTouchOutside(false);
        //        shapeLoadingDialog.show();
        OkHttpClient okHttpClient = new OkHttpClient();
        //        HashMap<String, String> params = new HashMap<String, String>();
        Random random    = new Random();
        String rom       = random.nextLong() + "";
        String timestamp = System.currentTimeMillis() + "";
        String userToken = SPUtils.getInstance(Consts.SPNAME).getString("userToken", "");
        String userId    = SPUtils.getInstance(Consts.SPNAME).getString("userId", "");


        RequestBody requestBody = new FormBody.Builder()
                .add("appid", Consts.appid)
                .add("nonce", rom)
                .add("timestamp", timestamp)

                .add("token", BankruptcyApp.tokeninfo.getToken())
                .add("userToken", userToken)

//                .add("creditorRightsId", mCreditorRightsId)
                .add("creditorId", creditorId)
                .add("projectId", mProid)
                .add("type", "1")

                .build();

        String url = Consts.WEBURL_CRDECDETAIL;
        Request request = new Request.Builder()
                .url(url)
                .post(requestBody)
                .build();

        okHttpClient.newCall(request).enqueue(new Callback() {
            @Override
            public void onFailure( Call call, IOException e ) {
                flag = false;
            }

            @Override
            public void onResponse( Call call, Response response ) throws IOException {

                //                shapeLoadingDialog.dismiss();

                flag = false;
                String str = response.body().string();

                try {


                    JSONObject object = new JSONObject(str);
                    if (object.optInt("code") == 0) {
                        //                        JSONObject dataobj = object.getJSONObject("data");
                        //                        JSONObject groupListobj = dataobj.getJSONObject("groupList");
                        //                        Iterator<String> it = groupListobj.keys();
                        //                        List<ManagerUserInfo> list = new ArrayList<>();
                        Gson gson = new Gson();
                        zqUserDetailInfo.clear();
                        ZQBaseInfo info = gson.fromJson(object.optString("data"), ZQBaseInfo.class);
                        info.setType(type);
                        zqUserDetailInfo.add(info);
                        getActivity().runOnUiThread(new Runnable() {

                            @Override
                            public void run() {
                                mAdapter.notifyDataSetChanged();
                            }

                        });

                        str = "";

                    }

                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        });
    }
    public static String addComma(String str) {
//        DecimalFormat decimalFormat = new DecimalFormat(",###");
//        return decimalFormat.format(Double.parseDouble(str));
        String money = CommonUtils.resetMoney(str);
        return money;
    }


    public void getDatatmp()
    {

        if(BankruptcyApp.tokeninfo == null|| BankruptcyApp.tokeninfo.getToken() == null)
        {
            flag= false;
            return;
        }
//        shapeLoadingDialog.setLoadingText("加载中...");
//        shapeLoadingDialog.setCanceledOnTouchOutside(false);
//        shapeLoadingDialog.show();
        OkHttpClient okHttpClient = new OkHttpClient();
//        HashMap<String, String> params = new HashMap<String, String>();
        Random random = new Random();
        String rom = random.nextLong()+"";
        String timestamp =System.currentTimeMillis()+"";
        String userToken = SPUtils.getInstance(Consts.SPNAME).getString("userToken","");
        String userId = SPUtils.getInstance(Consts.SPNAME).getString("userId","");


        RequestBody requestBody = new FormBody.Builder()
                .add("appid","1000000001")
                .add("nonce",rom)
                .add("timestamp", timestamp)

                .add("token", BankruptcyApp.tokeninfo.getToken())
                .add("userToken", userToken)

                .add("creditorId",creditorId)
                .add("projectId",mProid)
                .add("type","1")

                .build();

        String url = Consts.WEBURL_CRDECDGEN;
        Request request = new Request.Builder()
                .url(url)
                .post(requestBody)
                .build();

        okHttpClient.newCall(request).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {
                flag= false;
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {

//                shapeLoadingDialog.dismiss();

                flag= false;
                Boolean subtype = false;
                String str = response.body().string();

//                if(Consts.ISDEBUG)
//                {
//                    str = "{\"code\": 0,\"msg\":\"success\",\"data\": {\"groupList\": {\"综合管理组\": [{\"id\": \"222\",\"bankruptcyProjectId\": \"9c208e41eab641d59b88372c986605e9\",\"sysUserId\": \"93bec345da1d4699b2782c44bf190faf\",\"sysGroupId\": \"58cc083a3b944644b417b9134cdacb70\",\"subsidiaryOrgan\": \"江苏萌发科技有限公司\",\"groupLeader\": false,\"projectRole\": \"MANAGER\",\"projectColumnPermission\": \"0,1\",\"moneyPercent\": null,\"personnelPercent\": null,\"opManagementMembers\": false,\"opOtherMembers\": false,\"contactCreditor\": false,\"groupSentMessage\": false,\"sendSMS\": false,\"otherContactNumber\": \"\",\"user\": {\"id\": \"93bec345da1d4699b2782c44bf190faf\",\"loginname\": \"18655752308\",\"username\": \"王富贵\",\"avatar\": \"http://60.205.186.115:8001/group1/M00/00/04/rBHd5Fya1PmACFKoAAA7GwNBo1Q524-wmark.jpg?token=5cafcf4f7fefc726a00d3dc1cb3b506f&ts=1555298060\",\"company\": \"江苏萌发科技有限公司\",\"userOnline\": true,\"disabled\": false,\"email\": \"1262333517@qq.com\",\"mobile\": \"18655752308\",\"loginAt\": 1555291645,\"loginIp\": \"127.0.0.1\",\"loginCount\": 42,\"loginSessionId\": \"rshheaodbogbpo222899cl973s\",\"customMenu\": null,\"loginTheme\": \"palette.2.css\",\"menuTheme\": null,\"loginSidebar\": false,\"loginBoxed\": false,\"loginScroll\": true,\"loginPjax\": false,\"appInfoIdAndroid\": \"6748524783374e008f1103ea819a0fda\",\"appInfoIdIos\": null,\"unitid\": \"4db0951b9c5c4bbfbf6cf104cc2511c0\",\"unit\": null,\"appInfoIos\": null,\"appInfoAndroid\": null,\"roles\": null,\"units\": null,\"menus\": null,\"firstMenus\": null,\"secondMenus\": null,\"customMenus\": null,\"qq\": null,\"wx\": null,\"opBy\": \"93bec345da1d4699b2782c44bf190faf\",\"opAt\": 1551945057,\"delFlag\": false},\"group\": {\"id\": \"58cc083a3b944644b417b9134cdacb70\",\"bankruptcyProjectId\": \"9c208e41eab641d59b88372c986605e9\",\"code\": \"3lhb4vmfgmil6ofl7sonhepudp\",\"name\": \"综合管理组\",\"canDelete\": true,\"opBy\": \"93bec345da1d4699b2782c44bf190faf\",\"opAt\": 1554186594,\"delFlag\": false},\"opBy\": null,\"opAt\": null,\"delFlag\": false},{\"id\": \"68a0298f300949f89ed7715a6e87322c\",\"bankruptcyProjectId\": \"9c208e41eab641d59b88372c986605e9\",\"sysUserId\": \"6a779db54222423bbca09f0a46dfa112\",\"sysGroupId\": \"58cc083a3b944644b417b9134cdacb70\",\"subsidiaryOrgan\": null,\"groupLeader\": false,\"projectRole\": \"ADMINISTRATOR\",\"projectColumnPermission\": \"0,1,2,3,4,5,6\",\"moneyPercent\": null,\"personnelPercent\": null,\"opManagementMembers\": true,\"opOtherMembers\": false,\"contactCreditor\": false,\"groupSentMessage\": false,\"sendSMS\": false,\"otherContactNumber\": \"18949223929\",\"user\": {\"id\": \"6a779db54222423bbca09f0a46dfa112\",\"loginname\": \"18949223929\",\"username\": \"王富贵\",\"avatar\": \"\",\"company\": null,\"userOnline\": false,\"disabled\": false,\"email\": null,\"mobile\": \"18949223929\",\"loginAt\": null,\"loginIp\": null,\"loginCount\": 0,\"loginSessionId\": null,\"customMenu\": null,\"loginTheme\": null,\"menuTheme\": null,\"loginSidebar\": false,\"loginBoxed\": false,\"loginScroll\": false,\"loginPjax\": true,\"appInfoIdAndroid\": null,\"appInfoIdIos\": null,\"unitid\": \"4db0951b9c5c4bbfbf6cf104cc2511c0\",\"unit\": null,\"appInfoIos\": null,\"appInfoAndroid\": null,\"roles\": null,\"units\": null,\"menus\": null,\"firstMenus\": null,\"secondMenus\": null,\"customMenus\": null,\"qq\": null,\"wx\": null,\"opBy\": \"\",\"opAt\": 1554695416,\"delFlag\": false},\"group\": {\"id\": \"58cc083a3b944644b417b9134cdacb70\",\"bankruptcyProjectId\": \"9c208e41eab641d59b88372c986605e9\",\"code\": \"3lhb4vmfgmil6ofl7sonhepudp\",\"name\": \"综合管理组\",\"canDelete\": true,\"opBy\": \"93bec345da1d4699b2782c44bf190faf\",\"opAt\": 1554186594,\"delFlag\": false},\"opBy\": \"93bec345da1d4699b2782c44bf190faf\",\"opAt\": 1554695416,\"delFlag\": false}],\"负责人\": [{\"id\": \"111\",\"bankruptcyProjectId\": \"9c208e41eab641d59b88372c986605e9\",\"sysUserId\": \"f9ed9250560a4c49bdbc8bd38fa880e1\",\"sysGroupId\": \"20eec547dabf4ad9bb8e8899018eab7a\",\"subsidiaryOrgan\": null,\"groupLeader\": false,\"projectRole\": \"GROUPMEMBER\",\"projectColumnPermission\": \"0,1,2,3,4,5,6\",\"moneyPercent\": null,\"personnelPercent\": null,\"opManagementMembers\": true,\"opOtherMembers\": true,\"contactCreditor\": true,\"groupSentMessage\": true,\"sendSMS\": true,\"otherContactNumber\": \"13166330000\",\"user\": {\"id\": \"f9ed9250560a4c49bdbc8bd38fa880e1\",\"loginname\": \"15192282017\",\"username\": \"超级管理员\",\"avatar\": \"\",\"company\": null,\"userOnline\": true,\"disabled\": false,\"email\": \"wizzer@qq.com\",\"mobile\": \"15192282017\",\"loginAt\": 1555293607,\"loginIp\": \"127.0.0.1\",\"loginCount\": 58,\"loginSessionId\": \"ptert90374j4nrdumsq9q7nuia\",\"customMenu\": \"8c5d90d66c8149f19ef75855a45038f7,6e1aa6afe8ac44c9aed1b1a2883d683d,af28e4e506bc4cf795f7f84262befc15,1246a7fdc1eb46f8b3a7b193c5e47fd2,9a79503ec73c4d2788d46275834e2044\",\"loginTheme\": \"palette.2.css\",\"menuTheme\": \"top\",\"loginSidebar\": true,\"loginBoxed\": false,\"loginScroll\": false,\"loginPjax\": true,\"appInfoIdAndroid\": \"6748524783374e008f1103ea819a0fda\",\"appInfoIdIos\": \"36d661eaa4454ac9ade0373f04d58d03\",\"unitid\": \"4db0951b9c5c4bbfbf6cf104cc2511c0\",\"unit\": null,\"appInfoIos\": null,\"appInfoAndroid\": null,\"roles\": null,\"units\": null,\"menus\": null,\"firstMenus\": null,\"secondMenus\": null,\"customMenus\": null,\"qq\": null,\"wx\": null,\"opBy\": \"\",\"opAt\": 1551753746,\"delFlag\": false},\"group\": {\"id\": \"20eec547dabf4ad9bb8e8899018eab7a\",\"bankruptcyProjectId\": null,\"code\": \"administrator_group\",\"name\": \"负责人\",\"canDelete\": false,\"opBy\": \"f9ed9250560a4c49bdbc8bd38fa880e1\",\"opAt\": 1553567649,\"delFlag\": false},\"opBy\": null,\"opAt\": null,\"delFlag\": false}]},\"isManagerMember\": true,\"rolePermission\": {\"id\": \"222\",\"bankruptcyProjectId\": \"9c208e41eab641d59b88372c986605e9\",\"sysUserId\": \"93bec345da1d4699b2782c44bf190faf\",\"sysGroupId\": \"58cc083a3b944644b417b9134cdacb70\",\"subsidiaryOrgan\": \"江苏萌发科技有限公司\",\"groupLeader\": false,\"projectRole\": \"MANAGER\",\"projectColumnPermission\": \"0,1\",\"moneyPercent\": null,\"personnelPercent\": null,\"opManagementMembers\": false,\"opOtherMembers\": false,\"contactCreditor\": false,\"groupSentMessage\": false,\"sendSMS\": false,\"otherContactNumber\": \"\",\"user\": {\"id\": \"93bec345da1d4699b2782c44bf190faf\",\"loginname\": \"18655752308\",\"username\": \"王富贵\",\"avatar\": \"group1/M00/00/04/rBHd5Fya1PmACFKoAAA7GwNBo1Q524.jpg\",\"company\": \"江苏萌发科技有限公司\",\"userOnline\": true,\"disabled\": false,\"email\": \"1262333517@qq.com\",\"mobile\": \"18655752308\",\"loginAt\": 1555291645,\"loginIp\": \"127.0.0.1\",\"loginCount\": 42,\"loginSessionId\": \"rshheaodbogbpo222899cl973s\",\"customMenu\": null,\"loginTheme\": \"palette.2.css\",\"menuTheme\": null,\"loginSidebar\": false,\"loginBoxed\": false,\"loginScroll\": true,\"loginPjax\": false,\"appInfoIdAndroid\": \"6748524783374e008f1103ea819a0fda\",\"appInfoIdIos\": null,\"unitid\": \"4db0951b9c5c4bbfbf6cf104cc2511c0\",\"unit\": null,\"appInfoIos\": null,\"appInfoAndroid\": null,\"roles\": null,\"units\": null,\"menus\": null,\"firstMenus\": null,\"secondMenus\": null,\"customMenus\": null,\"qq\": null,\"wx\": null,\"opBy\": \"93bec345da1d4699b2782c44bf190faf\",\"opAt\": 1551945057,\"delFlag\": false},\"group\": null,\"opBy\": null,\"opAt\": null,\"delFlag\": false}}}\n";
//                }
                try{


                    JSONObject object = new JSONObject(str);
                    if  (object.optInt("code") == -10004 || (object.optInt("code") == -10003))
                    {

                        getActivity().runOnUiThread(new Runnable() {

                            @Override
                            public void run() {
                                LoginNoticeDialog.showPage(object.optString("msg"));
                            }

                        });

                        return;
                    }
                    if(object.optInt("code") == 0)
                    {
                        JSONObject dataobj = object.getJSONObject("data");
                        final ProZQUserZQInfo  proZQUserZQInfo = new ProZQUserZQInfo();
//                        JSONObject groupListobj = dataobj.getJSONObject("groupList");
//                        Iterator<String> it = groupListobj.keys();

                        Gson gson = new Gson();
                        final ZQUserDetailBaseInfo infotmp = gson.fromJson(dataobj.optString("creditorInfoTemp"),ZQUserDetailBaseInfo.class);
                        if(infotmp !=null)
                        {
//                            proZQUserZQInfo.itemType = 22;//待验证
//                            proZQUserZQInfo.setZqUserDetailBaseInfo(infotmp);
                            return;

                        }else {
                            zqUserDetailInfo.clear();
                            final ZQUserDetailBaseInfo info = gson.fromJson(dataobj.optString("creditorInfo"), ZQUserDetailBaseInfo.class);
                            proZQUserZQInfo.hasClaimTime = dataobj.optString("hasClaimTime");
                            proZQUserZQInfo.itemType = 101;

                            if ("2".equalsIgnoreCase(info.getProcessStatus().getValue())) {
                                String strhasClaimTime = dataobj.optString("hasClaimTime");
                                proZQUserZQInfo.setHasClaimTime(strhasClaimTime);

                                String strTime = dataobj.optString("claimFilingStartTime");
                                boolean showFlag= false;
                                if(strTime !=null &&!"".equalsIgnoreCase(strTime) && "null".equalsIgnoreCase(strTime))
                                {
                                    long lst_time = StringToLeng(strTime);
                                    long nowtime1 =  System.currentTimeMillis()/1000;
                                    if(lst_time>nowtime1)
                                    {
                                        showFlag=false;
                                    }else{
                                        showFlag =true;
                                    }
                                }

                                ProZQUserZQInfo proZQUserZQInfo2 = new ProZQUserZQInfo();
                                proZQUserZQInfo2.setZqUserDetailBaseInfo(info);
                                proZQUserZQInfo2.setClaimFilingStartTime(dataobj.optString("claimFilingStartTime"));
                                proZQUserZQInfo2.setClaimFilingEndTime(dataobj.optString("claimFilingEndTime"));
                                proZQUserZQInfo2.setHasCrDecTemp(dataobj.optString("hasCrDecTemp"));
                                proZQUserZQInfo2.itemType = 8;
                                proZQUserZQInfo2.setZqUserDetailBaseInfo(info);
                                proZQUserZQInfotmp = proZQUserZQInfo2;


                            }
//                            proZQUserZQInfo.setZqUserDetailBaseInfo(info);
                        }

                        ZQBaseInfo info = gson.fromJson(object.optString("data"), ZQBaseInfo.class);
                        info.setType(1);
                        zqUserDetailInfo.add(info);
                        getActivity().runOnUiThread(new Runnable() {

                            @Override
                            public void run() {
                                mAdapter.notifyDataSetChanged();
                            }

                        });


                        final Boolean f_subtype = subtype;
//                        zqUserDetailInfo.add(info);
                        getActivity().runOnUiThread(new Runnable() {

                            @Override
                            public void run() {

//                                if(f_subtype)
//                                {
//                                    getSubData(info.getSysUserId());
//                                }else {
                                mAdapter.notifyDataSetChanged();
//                                }
                            }

                        });

                        str = "";

                    }

                }catch (Exception ex)
                {
                    flag= false;
                    ex.printStackTrace();
                }
            }
        });
    }

}